<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改药品库存')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-inventory-edit" th:object="${drugInventory}">
            <input name="drugId" th:field="*{drugId}" type="hidden">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">药品名称：</label>
                    <div class="col-sm-8">
                        <input name="drugName" th:field="*{drugName}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">规格：</label>
                    <div class="col-sm-8">
                        <input name="specification" th:field="*{specification}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">生产厂家：</label>
                    <div class="col-sm-8">
                        <input name="manufacturer" th:field="*{manufacturer}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">库存数量：</label>
                    <div class="col-sm-8">
                        <input name="stockQuantity" th:field="*{stockQuantity}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">批次号：</label>
                    <div class="col-sm-8">
                        <input name="batchNumber" th:field="*{batchNumber}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">有效期：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="expirationDate" th:value="${#dates.format(drugInventory.expirationDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">进价：</label>
                    <div class="col-sm-8">
                        <input name="purchasePrice" th:field="*{purchasePrice}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">零售价：</label>
                    <div class="col-sm-8">
                        <input name="retailPrice" th:field="*{retailPrice}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">存放位置：</label>
                    <div class="col-sm-8">
                        <input name="storageLocation" th:field="*{storageLocation}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">库存预警阈值：</label>
                    <div class="col-sm-8">
                        <input name="warningThreshold" th:field="*{warningThreshold}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">删除标志(0存在 2删除)：</label>
                    <div class="col-sm-8">
                        <input name="delFlag" th:field="*{delFlag}" class="form-control" type="text">
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/inventory";
        $("#form-inventory-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-inventory-edit').serialize());
            }
        }

        $("input[name='expirationDate']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>